package com.ccb.lms.service;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.ccb.lms.dto.ReaderBorrowCopyBookAuthority;
import com.ccb.lms.dto.ReaderBorrowHistoryDto;
import com.ccb.lms.facade.FacadeDAO;
import com.ccb.lms.model.Reader;
import com.ccb.lms.util.BasePage;

public class ReaderService implements IReaderService {

	private FacadeDAO facadeDAO = null;

	
	public FacadeDAO getFacadeDAO() {
		return facadeDAO;
	}

	public void setFacadeDAO(FacadeDAO facadeDAO) {
		this.facadeDAO = facadeDAO;
	}

	public boolean isLogin(Reader reader) throws SQLException {
		// TODO Auto-generated method stub
		return facadeDAO.getReaderDAO().isLogin(reader);
	}

	public boolean insertReader(Reader reader) throws SQLException {
		// TODO Auto-generated method stub
		return facadeDAO.getReaderDAO().insertReader(reader);
	}

	public boolean deleteReader(Integer readerNO) throws SQLException {
		// TODO Auto-generated method stub
		return facadeDAO.getReaderDAO().deleteReader(readerNO);
	}

	public boolean updateReader(Reader reader) throws SQLException {
		// TODO Auto-generated method stub
		return facadeDAO.getReaderDAO().updateReader(reader);
	}

	public List<Reader> getAllReaders() throws SQLException {
		// TODO Auto-generated method stub
		return facadeDAO.getReaderDAO().getAllReaders();
	}

	public Reader getReaderByID(String readerID) throws SQLException {
		// TODO Auto-generated method stub
		return facadeDAO.getReaderDAO().getReaderByID(readerID);
	}

	public int getReaderCount() throws SQLException {
		// TODO Auto-generated method stub
		return facadeDAO.getReaderDAO().getReaderCount();
	}

	public BasePage getBasePage(int currentPage, int showRecordNum)
			throws SQLException {
		// TODO Auto-generated method stub
		return facadeDAO.getReaderDAO().getBasePage(currentPage, showRecordNum);
	}

	public List<Reader> getReaderByPage(BasePage basePage) throws SQLException {
		// TODO Auto-generated method stub
		return facadeDAO.getReaderDAO().getReaderByPage(basePage);
	}
	

	public List<ReaderBorrowCopyBookAuthority> getReaderCurrentBorrowDetails(int readerNO) throws SQLException{
		return facadeDAO.getReaderDAO().getReaderCurrentBorrowDetails(readerNO);
	}

	public ArrayList<ReaderBorrowHistoryDto> getReaderBorrowHistoryDtosByreaderNO(
			int readerNO) {
		// TODO Auto-generated method stub
		return facadeDAO.getReaderDAO().getReaderBorrowHistoryDtosByreaderNO(readerNO);
	}


}
